package edu.suda.xsap.service.impl;

import edu.suda.xsap.entity.CourseCard;
import edu.suda.xsap.mapper.CourseCardMapper;
import edu.suda.xsap.service.CourseCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseCardImpl implements CourseCardService {
    @Autowired
    private CourseCardMapper courseCardMapper;


    @Override
    public void delete(Integer cardId, Integer courseId) {
        courseCardMapper.delete(cardId, courseId);
    }

    @Override
    public void save(Integer cardId, Integer courseId) {
        CourseCard courseCard = new CourseCard();
        courseCard.setCardId(cardId);
        courseCard.setCourseId(courseId);
        courseCardMapper.save(courseCard);
    }

    @Override
    public List<CourseCard> findByCardId(Integer id) {
        return courseCardMapper.findByCardId(id);
    }

    @Override
    public List<CourseCard> findByCourseId(Integer id) {
        return courseCardMapper.findByCourseId(id);
    }

    @Override
    public List<CourseCard> findAll() {
        return courseCardMapper.findAll();
    }
}
